from typing import Optional
from sqlalchemy.orm import Session
from mooc.crud.crud_base import CRUDBase

from mooc.models.goouc_fullexam_user import (
    # 导入全部
    UserDoexam,
    UserDoOtherExamAnswer,
    UserExamAnswer,
    UserSpecial,
    UserSpequence,
    UserMember,
    UserCollectionPraction,
    UserGift,
    UserQhigh,
    UserQintensive,
    UserRead,
    UserDootherExam,
    UserWrongPraction,
    UserPool,
)
from mooc.schemas.goouc_fullexam_user import (
    # 导入全部create和update
    UserDoexamCreate,
    UserDoexamUpdate,
    UserDoOtherExamAnswerCreate,
    UserDoOtherExamAnswerUpdate,
    UserExamAnswerCreate,
    UserExamAnswerUpdate,
    UserSpecialCreate,
    UserSpecialUpdate,
    UserSpequenceCreate,
    UserSpequenceUpdate,
    UserMemberCreate,
    UserMemberUpdate,
    UserCollectionPractionCreate,
    UserCollectionPractionUpdate,
    UserGiftCreate,
    UserGiftUpdate,
    UserQHighCreate,
    UserQHighUpdate,
    UserQIntensiveCreate,
    UserQIntensiveUpdate,
    UserReadCreate,
    UserReadUpdate,
    UserDoOtherExamCreate,
    UserDoOtherExamUpdate,
    UserWrongPractionCreate,
    UserWrongPractionUpdate,
    UserPoolCreate,
    UserPoolUpdate,
)


class CRUDUserDoexam(CRUDBase[UserDoexam, UserDoexamCreate, UserDoexamUpdate]):
    def get_user_doexam(self, db: Session, user_doexam_id: int):
        return self.get_by_field(db, "id", user_doexam_id)


class CRUDUserDoOtherExamAnswer(
    CRUDBase[UserDoOtherExamAnswer, UserDoOtherExamAnswerCreate, UserDoOtherExamAnswerUpdate]):
    def get_user_doother_exam_answer(self, db: Session, user_doother_exam_answer_id: int):
        return self.get_by_field(db, "id", user_doother_exam_answer_id)


class CRUDUserExamAnswer(CRUDBase[UserExamAnswer, UserExamAnswerCreate, UserExamAnswerUpdate]):
    def get_user_exam_answer(self, db: Session, user_exam_answer_id: int):
        return self.get_by_field(db, "id", user_exam_answer_id)


class CRUDUserSpecial(CRUDBase[UserSpecial, UserSpecialCreate, UserSpecialUpdate]):
    def get_user_special(self, db: Session, user_special_id: int):
        return self.get_by_field(db, "id", user_special_id)


class CRUDUserSpequence(CRUDBase[UserSpequence, UserSpequenceCreate, UserSpequenceUpdate]):
    def get_user_spequence(self, db: Session, user_spequence_id: int):
        return self.get_by_field(db, "id", user_spequence_id)


class CRUDUserMember(CRUDBase[UserMember, UserMemberCreate, UserMemberUpdate]):
    def get_user_member(self, db: Session, user_member_id: int):
        return self.get_by_field(db, "id", user_member_id)


class CRUDUserCollectionPraction(
    CRUDBase[UserCollectionPraction, UserCollectionPractionCreate, UserCollectionPractionUpdate]):
    def get_user_collection_praction(self, db: Session, user_collection_praction_id: int):
        return self.get_by_field(db, "id", user_collection_praction_id)


class CRUDUserGift(CRUDBase[UserGift, UserGiftCreate, UserGiftUpdate]):
    def get_user_gift(self, db: Session, user_gift_id: int):
        return self.get_by_field(db, "id", user_gift_id)


class CRUDUserQHigh(CRUDBase[UserQhigh, UserQHighCreate, UserQHighUpdate]):
    def get_user_qhigh(self, db: Session, user_qhigh_id: int):
        return self.get_by_field(db, "id", user_qhigh_id)


class CRUDUserQIntensive(CRUDBase[UserQintensive, UserQIntensiveCreate, UserQIntensiveUpdate]):
    def get_user_qintensive(self, db: Session, user_qintensive_id: int):
        return self.get_by_field(db, "id", user_qintensive_id)


class CRUDUserRead(CRUDBase[UserRead, UserReadCreate, UserReadUpdate]):
    def get_user_read(self, db: Session, user_read_id: int):
        return self.get_by_field(db, "id", user_read_id)


class CRUDUserDoOtherExam(CRUDBase[UserDootherExam, UserDoOtherExamCreate, UserDoOtherExamUpdate]):
    def get_user_doother_exam(self, db: Session, user_doother_exam_id: int):
        return self.get_by_field(db, "id", user_doother_exam_id)


class CRUDUserWrongPraction(CRUDBase[UserWrongPraction, UserWrongPractionCreate, UserWrongPractionUpdate]):
    def get_user_wrong_praction(self, db: Session, user_wrong_praction_id: int):
        return self.get_by_field(db, "id", user_wrong_praction_id)


class CRUDUserPool(CRUDBase[UserPool, UserPoolCreate, UserPoolUpdate]):
    def get_user_pool(self, db: Session, user_pool_id: int):
        return self.get_by_field(db, "id", user_pool_id)
